#include <string>
#include <stdio.h>
#include <string.h>

using namespace std;

int myfind(char* original, char* sub){
	int diff = strlen(original) - strlen(sub);
	bool found = false;
	int i = 0;
	for(i = 0; i <= diff; i++){
		printf("%s, %s , %d , %d \n", original+i, sub, strlen(sub), strncmp( original+i, sub, strlen(sub) ));
		if(strncmp( original+i, sub, strlen(sub) ) == 0) {
			i++;
			found = true;
			break;
		}
	}
	if(found == true)return (i-1);
	else return -1;
}

int main(){
	char p[] = "Hello world";
	char sub[] = "ello";
	int ind = myfind(p, sub);
	printf("\n\n%d\n", ind);

	return 0;
}


